package com.example.javaairportflightanalysis.dao;

import com.example.javaairportflightanalysis.domin.check.DfdlCheckAD;
import com.example.javaairportflightanalysis.domin.check.TransferCheckAD;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;

import java.util.List;

public interface DfdlCheckMapper {
    /**
     * 更新A直达的状态和UUID
     */
    @Update("update Dfdl_A set STATUS = #{status},UUID=#{uuid} where id = #{id}")
    Integer updateStatusA(Integer status, String uuid, Integer id);
    @Insert("insert into zbtj.Dfdl_Check_A" +
            "(DFLT_FLNO,DFLT_AWCD,APCD,DTIME,FPTT,FPLT,STATUS,Flight_Status,UUID) " +
            "values(#{dfltFlno},#{dfltAwcd},#{apcd},#{dtime},#{fptt},#{fplt},#{status},#{flightStatus},#{uuid})")
    Integer insertDfdlCheckA(DfdlCheckAD dfdlCheckAD);
    @Select("select * from zbtj.Dfdl_Check_A where uuid = #{uuid}")
    DfdlCheckAD selectByUuidA(String uuid);
    /**
     * 显示正在审核的数据
     */
    @Select("select DFLT_FLNO,DFLT_AWCD,APCD,DTIME,FPTT,FPLT,STATUS,Flight_Status,UUID from zbtj.Dfdl_Check_A")
    List<DfdlCheckAD> selectAllDateA(Integer pageNum, Integer pageSize);



    @Update("update Transfer_A set STATUS = #{status},UUID=#{uuid} where id = #{id}")
    Integer updateTransferStatusA(Integer status, String uuid, Integer id);
    @Insert("insert into zbtj.Transfer_Check_A" +
            "(dfltFlno,dfltAwcd,transitApcd,APCD,DTIME,FPTT,FPLT,STATUS,Flight_Status,UUID) " +
            "values(#{dfltFlno},#{dfltAwcd},#{transitApcd},#{apcd},#{dtime},#{fptt},#{fplt},#{status},#{flightStatus},#{uuid})")
    Integer insertTransferCheckA(TransferCheckAD transferCheckAD);
    @Select("select * from zbtj.Transfer_Check_A where uuid = #{uuid}")
    TransferCheckAD selectByTransferUuidA(String uuid);
    @Select("select * from zbtj.Transfer_Check_A")
    List<TransferCheckAD> selectAllTransferA(Integer pageNum, Integer pageSize);




    @Select("select * from zbtj.Transfer_Check_D where uuid = #{uuid}")
    DfdlCheckAD selectByUuidD(String uuid);
    @Insert("insert into zbtj.Dfdl_Check_D" +
            "(DFLT_FLNO,DFLT_AWCD,APCD,DTIME,FPTT,FPLT,STATUS,Flight_Status,UUID) " +
            "values(#{dfltFlno},#{dfltAwcd},#{apcd},#{dtime},#{fptt},#{fplt},#{status},#{flightStatus},#{uuid})")
    Integer insertDfdlCheckD(DfdlCheckAD dfdlCheckAD);
    @Select("select DFLT_FLNO,DFLT_AWCD,APCD,DTIME,FPTT,FPLT,STATUS,Flight_Status,UUID from zbtj.Dfdl_Check_D")
    List<DfdlCheckAD> selectAllDateD(Integer pageNum, Integer pageSize);
    /**
     * 更新D直达的状态和UUID
     */
    @Update("update Dfdl_D set STATUS = #{status},UUID=#{uuid} where id = #{id}")
    void updateDStatus(Integer status, String uuid, Integer id);



    @Update("update Transfer_D set STATUS = #{status},UUID=#{uuid} where id = #{id}")
    Integer updateTransferStatusD(Integer status, String uuid, Integer id);
    @Insert("insert into zbtj.Transfer_Check_D" +
            "(dfltFlno,dfltAwcd,transitApcd,APCD,DTIME,FPTT,FPLT,STATUS,Flight_Status,UUID) " +
            "values(#{dfltFlno},#{dfltAwcd},#{transitApcd},#{apcd},#{dtime},#{fptt},#{fplt},#{status},#{flightStatus},#{uuid})")
    Integer insertTransferCheckD(TransferCheckAD transferCheckAD);
    @Select("select * from zbtj.Transfer_Check_D where uuid = #{uuid}")
    TransferCheckAD selectByTransferUuidD(String uuid);
    @Select("select * from zbtj.Transfer_Check_D")
    List<TransferCheckAD> selectAllTransferD(Integer pageNum, Integer pageSize);


}
